import { createRouter, createWebHistory } from "vue-router"
import Home from "../views/Home.vue"
import SmartHome from "../views/SmartHome.vue"
import Industrial from "../views/Industrial.vue"
import Medical from "../views/Medical.vue"
import Security from "../views/Security.vue"

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/smart-home",
    name: "SmartHome",
    component: SmartHome,
  },
  {
    path: "/industrial",
    name: "Industrial",
    component: Industrial,
  },
  {
    path: "/medical",
    name: "Medical",
    component: Medical,
  },
  {
    path: "/security",
    name: "Security",
    component: Security,
  },
]

const router = createRouter({
  history: createWebHistory(),
  routes,
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return { top: 0 }
    }
  },
})

export default router
